package com.wyan.wiki.controller;

import com.wyan.wiki.req.CategoryQueryReq;
import com.wyan.wiki.req.CategorySaveReq;
import com.wyan.wiki.resp.CommonResp;
import com.wyan.wiki.resp.CategoryQueryResp;
import com.wyan.wiki.resp.PageResp;
import com.wyan.wiki.service.CategoryService;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/category")
public class CategoryController {
    @Resource
    private CategoryService categoryService;

    @GetMapping("/list1")
    public CommonResp list(@Valid CategoryQueryReq req){
        CommonResp<PageResp<CategoryQueryResp>> resp =new CommonResp<>();
        PageResp<CategoryQueryResp> list=categoryService.list(req);
        resp.setContent(list);
        return resp;
    }
    @GetMapping("/all")
    public CommonResp all(){
        CommonResp<List<CategoryQueryResp>> resp = new CommonResp<>();
        List<CategoryQueryResp> list =categoryService.all();
        resp.setContent(list);
        return resp;
    }

//    @DeleteMapping("/delete/{id}")
//    public CommonResp delete(@PathVariable Long id){
//        CommonResp resp = new CommonResp<>();
//        categoryService.delete(id);
//        return resp;
//    }

}